<?php
//后台登陆控制
include_once('admin_global.php');
$db->Get_user_shell_check($uid, $shell);   //检测用户是否登录
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理员列表</title>
    <link rel="stylesheet" href="css/right.css" type="text/css" />
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/bggl.js" type="text/javascript"></script>
</head>
<script>
    function delAdmin()
    {
        if (window.confirm("你确定要删除此管理员吗？"))
            return true;
        else
            return false;
    }
</script>
<?php
//查询管理员信息
$userType=$_SESSION['userType'];
$userID=$_SESSION['uid'];
if($userType=="普通管理员"){
    $sql="SELECT * FROM admin WHERE userID='$userID'";
}else{
    $sql = "SELECT * FROM admin";
}
$query = $db->query($sql);
?>
<body>
<div id="right_main">
    <div class="right_content">
        <div class="right_top_menu">
            <h3>
                您当前的位置：后台 > 管理员设置 > 管理员列表
            </h3>
        </div>
        <div class="right_center_content">
            <form id="form1" method="post" action="">
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td valign="top" >
                            <div class="txl_search"></div>
                            <table cellpadding="0" cellspacing="0" border="0" width="100%" class="fg_table txl_table" id="table1">
                                <tr>
                                    <th width="4%">ID</th>
                                    <th width="10%">用户名称</th>
                                    <th width="5%">性别</th>
                                    <th width="10%">用户类型</th>
                                    <th width="15%">用户邮箱</th>
                                    <th width="15%">创建时间</th>
                                    <th width="15%">最近登录时间</th>
                                    <th width="13%">最近登录IP</th>
                                    <th width="5%">是否激活</th>
                                    <th width="4%">修改</th>
                                    <th width="4%">删除</th>
                                </tr>
                                <?php while($row = $db->fetch_array($query)) {; ?>
                                    <tr>
                                        <td><?php echo $row['userID']; ?></td>
                                        <td><?php echo $row['userName']; ?></td>
                                        <td><?php echo $row['userSex']; ?></td>
                                        <td><?php echo $row['userType']; ?></td>
                                        <td><?php echo $row['userEmail']; ?></td>
                                        <td><?php echo date('Y-m-d H:i:s',$row['userCreateTime']); ?></td>
                                        <td><?php echo date('Y-m-d H:i:s',$row['recentLoginTime']); ?></td>
                                        <td><?php echo $row['recentLoginIP']; ?></td>
                                        <?php
                                        if ($row['userEnabled'] == 1) {
                                            $userEnabled = "是";
                                        } else {
                                            $userEnabled = "否";
                                        }
                                        ?>
                                        <td><?php echo $userEnabled; ?></td>
                                        <td><a href="editAdmin.php?userID=<?php echo $row["userID"]; ?>"><img src="images/adj_bg.gif" width="15" height="15" border="0" /></a></td>
                                        <td><a href="delAdmin.php?userID=<?php echo $row["userID"]; ?>" onclick="javascript:return delAdmin();"><img src="images/del2.gif" width="16" height="16" border="0" /></a></td>
                                    </tr>
                                <?php }; ?>
                            </table>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
</body>
</html>
